<template>
	<el-main>
		<el-row :gutter="15">
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option"></scEcharts>
				</el-card>
			</el-col>
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option2"></scEcharts>
				</el-card>
			</el-col>
			<el-col :lg="8">
				<el-card shadow="never">
					<scEcharts height="300px" :option="option3"></scEcharts>
				</el-card>
			</el-col>
		</el-row>
	</el-main>
</template>

<script>
import scEcharts from '@/components/scEcharts';
export default {
	name: 'chart',
	components: {
		scEcharts
	},
	data() {
		return {
			option: {},
			option2: {},
			option3: {
				title: {
					text: '月报价量趋势',
					subtext: '月份报价单趋势分析',
				},
				grid: {
					top: '80px'
				},
				tooltip: {
					trigger: 'axis'
				}
			}
		}
	},
	mounted() {
		this.getBiQuotationByDeptPie();
		this.getBiQuotationByAccountPie();
		this.getBiQuotationByMonthLine();
	},
	methods:{
		async getBiQuotationByDeptPie(){
			var res = await this.$API.crm.echarts.getBiQuotationByDeptPie.get();
			if (res.code == 200) {
				this.option = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getBiQuotationByAccountPie(){
			var res = await this.$API.crm.echarts.getBiQuotationByAccountPie.get();
			if (res.code == 200) {
				this.option2 = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		async getBiQuotationByMonthLine()
		{
			var res = await this.$API.crm.echarts.getBiQuotationByMonthLine.get();
			if (res.code == 200) {
				this.option3 = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
	}
}
</script>

<style>
</style>
